package com.itheima.app.controller;

import com.itheima.app.manager.CardManger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
public class CardCollection {

    @Autowired
    private CardManger cardManger;

    //查询卡片展示（mongo）
    @GetMapping("/tanhua/cards")
    public ResponseEntity findCard() {

        return cardManger.findCard();
    }

    //右滑喜欢
    @GetMapping("/tanhua/{likeUsrId}/love")
    public  void rightLove(@PathVariable Integer likeUsrId) {

         cardManger.rightLove(likeUsrId);
    }

    //左滑不喜欢
    @GetMapping("/tanhua/{likeuserId}/unlove")
    public void leftLove(@PathVariable Integer likeuserId) {
        cardManger.leftLove(likeuserId);
    }
    // 喜欢 粉丝 互相喜欢
    @GetMapping("/users/counts")
    public ResponseEntity findlovelikefen() {

        return cardManger.findlovelikefen();
    }


    // 喜欢 粉丝 互相喜欢 的人
    @GetMapping("/users/friends/{type}")
    public ResponseEntity findlovelikefenUserInfo(@RequestParam(value = "page",defaultValue = "1") Integer pageNumber,
                                                  @RequestParam("pagesize") Integer pageSize, String nickname,
                                                  @PathVariable Integer type) {

      return   cardManger.findlovelikefenUserInfo(pageNumber,pageSize,type);



    }

    //喜欢
    @PostMapping("/users/fans/{uid}")
    public void findLove(@PathVariable Long uid) {


        cardManger.findLove(uid);

    }

    //取消喜欢
    @DeleteMapping("/users/like/{udi}")
    public void deleLove(@PathVariable Long udi) {
        cardManger.deleteLove(udi);
    }





}
